<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <title>房屋入库</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=f5a12a1d">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        table input {
            border: none;
            width: 100%;
        }
        .table-detail td.td-value2{
            padding: 1px !important;
            text-align: left !important;
        }
        .td-value2 input{
            box-shadow: inset 1px 1px 4px #333;
            height:100% !important;
            padding-left:4px !important;
        }
        .td-value2 span{
            padding-left:4px !important;
        }
        .td-value2 select{
            box-shadow: inset 1px 1px 4px #333;
            height:100% !important;
            padding-left:4px !important;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
        .lineOne {
            text-align: left;
        }
        .table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th {
            height: 24px;
            vertical-align: middle;
            padding: 1px ;
        }
        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }
        input[type=text], input[type=tel], input[type=number], select {
            box-sizing: border-box;
            border-width: 0px;
            border-style: none;
            padding-right: 0px !important;
            padding-top: 0px !important;
            padding-bottom: 0px !important;
            margin-left: 0px !important;
            margin-right: 0px !important;
            margin-top: 0px !important;
            margin-bottom: 0px !important;
            padding-left: 6px;
        }

        input[type=text], input[type=tel], input[type=number], select {
            height: 24px;
            width: 100%;
            border: none;
            outline: none;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }
        .user {
            height: 30px;
            line-height: 30px;
            max-height: 30px;
            float: left;
            text-align: left;
            min-width: 32px;
            padding-left: 1px;
            overflow: hidden;
            cursor: pointer;
        }

        .user:hover {
            background-color: #cfd4d1;
        }

        .userbox .select.user {
            color: #fff;
            background-color: #045B9E;
        }

        .span-btn {
            position: absolute;
            left: 10px;
            margin-top: 4px;
            cursor: pointer;
        }

        .auditorName {
            text-align: center;
        }

        .IcoNormal {
            float: left;
            border-bottom: 0px;
            border-left: 0px;
            background-color: transparent;
            width: 16px;
            height: 16px;
            /*vertical-align: middle;*/
            border-top: 0px;
            border-right: 0px;
            background-image: url(/dist/img/upload_normal.gif);
            background-repeat: no-repeat;
            float: left;
        }

        .progressobj {
            height: 20px;
        }

        .progressobj .delfile {
            float: left;
            margin-left: 10px;
        }
        .biTian {
            position: absolute;
            color: #000;
            margin-left: -15px;
            margin-top: 2px;
        }
        .yuan {
            position: absolute;
            top: 5px;
            left: 110px;
        }
        .select {
            color: #fff;
            background-color: #045B9E;
        }

        td .sp-value {
            display: inline-block;
            padding-left: 6px;
            word-wrap: break-word;
        }

        td.td-value2,td span {
            color: #2a8cec;
        }

        td.td-title, td select, td .filename, td.td-module {
            color: #333;
            font-weight: normal !important;
        }

        .table-detail-payee:nth-child(even) td.td-title {
            background-color: white;
        }
        .webuploader-pick {
            background: url(/dist/img/fjT1.png) no-repeat 5px center;
            display: block;
            padding: 0 4px;
            height: 22px;
            line-height: 22px;
            padding-left: 15px;
            margin: 0 auto;
            width: 70px;
            margin-top: 6px;
            border-radius: 4px;
        }
        .webuploader-pick-hover{
            color: #fff!important;
            background: url(/dist/img/fjT2.png) no-repeat 5px center;
            background-color: #0F6099;

        }
        #divUploadedFiles{
            /*padding: 4px;*/
            padding-bottom: 0;
        }

        .printDiv {
            display: none;
        }
        .title{
            background-color: yellow;
            color:black;
        }
        .jiaobiao3 {
            position: relative;
        }

        .jiaobiao3 i {
            display: block;
            width: 10px;
            height: 10px;
            background: url("/dist/img/newLog3.png");
            position: absolute;
            top: 0px;
            right: 0px;
        }
        .moreListData{
            position: absolute;
            top: 30px;
            z-index: 111;
            display:none;
        }
        .moreListData .item{
            width: 100%;
            height: 30px;
            line-height: 30px;
        }
        .moreListData .item span{
            margin-right: 5px;
        }
        .ui_main{
            vertical-align: top;
        }
        .table-detail textarea {
            height: 60px;
            width: 100%;
            border: none;
            outline: none;
            -webkit-appearance: none;
            resize: none;
            line-height: 20px;
            padding-top: 2px !important;
            padding-left: 6px;
        }
    </style>
</head>

<body>
<iframe id="ifAttach" style="display:none"></iframe>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div id="div" style="margin-top: 12px">
        <div style="float: left;width:100%;">
            <div class="center" style="overflow: auto;margin-left: -10px;margin-top:-20px"
                 id="scrollDiv">
                <div id="progress" class="wyui-progress"></div>
                <table class="table-detail" id="week" >
                    <tr class="no-print" >
                        <td colspan="4" class=" no-print  title">公司人员信息</td>
                    </tr>
                    <tr class="td-row2 td-value" style="height:30px;">
                        <td style="color:black;background-color:#F8F8F8;width: 25%"><i class="biTian">*</i>归属公司</td>
                        <td style="width: 25%;" class="td-value2">
                            <select id="company" v-if="showInput('0')" v-model="displace.fkCompanyId" @change="getBran"  style="color: #2a8cec !important;padding-left: 2px;">
                                <option selected value="" ></option>
                                <option v-for="option in companyList" v-bind:value="option.id">
                                    {{option.name}}
                                </option>
                            </select>
                        <span v-else class="pull-left">{{displace.companyName}}</span>
                        </td>
                        <td style="color:black;background-color:#F8F8F8;width: 25%">区域</td>
                        <td style="width: 25%;" class="td-value2 moreList" data-table="t_dvc_displace" data-column="regionName" data-type='1'>
                            <select class=" td-row2 td-value" id="testRe" v-model="displace.regionId"  @change="getBigRegionManager" style=" padding-left: 2px;"
                                    v-if="showInput('区域')">
                                <option value=""></option>
                                <option v-for="itemR in regions" v-bind:value="itemR.regionId">{{itemR.regionName}}</option>
                            </select>
                            <span v-else class="pull-left">{{displace.regionName}}</span>
                        </td>
                    </tr>

                    <tr class="td-row2 td-value" style="height:30px ">
                        <td style="color:black;background-color:#F8F8F8;">大区经理</td>
                        <td class="td-value2 moreList" data-table="t_dvc_displace" data-column="bigregionManagerName" data-type='1'>
                            <select class=" td-row2 td-value" id="testBig" v-model="displace.bigregionManagerId"  @change="getRegionManager" style=" padding-left: 2px;"
                                    v-if="showInput('大区经理')">
                                <option value=""></option>
                                <option v-for="itemBig in bigRegionManager" v-bind:value="itemBig.userId">{{itemBig.userName}}</option>
                            </select>
                            <span v-else class="pull-left">{{displace.bigregionManagerName}}</span>
                        </td>
                        <td style="color:black;background-color:#F8F8F8">区域经理</td>
                        <td class="td-value2 moreList" data-table="t_dvc_displace" data-column="regionManagerName" data-type='1'>
                            <select class=" td-row2 td-value" id="testReg" v-model="displace.regionManagerId"  style=" padding-left: 2px;"
                                    v-if="showInput('区域经理')">
                                <option value=""></option>
                                <option v-for="itemReg in regionManager" v-bind:value="itemReg.userId">{{itemReg.userName}}</option>
                            </select>
                            <span v-else class="pull-left">{{displace.regionManagerName}}</span>
                        </td>
                    </tr>
                    <tr class="no-print">
                        <td colspan="4" class=" no-print  title" >基本信息</td>
                    </tr>
                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8"><i class="biTian">*</i>房屋类型</td>
                        <td class="td-value2">
                            <select v-if="showInput('0')" v-model="displace.replacementType" style="color: #2a8cec !important;padding-left: 2px;">
                                <option v-for="option in replacementTypeList" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="pull-left">{{displace.replacementType}}</span>
                        </td>
                        <td style="color:black;background-color:#F8F8F8">所在地</td>
                        <td class="td-value2">
                            <input type="text"  v-model="displace.storeAddress"  v-if="showInput('0')">
                            <span v-else class="pull-left">{{displace.storeAddress}}</span>
                        </td>
                    </tr>

                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8"><i class="biTian">*</i>房屋名称</td>
                        <td class="td-value2">
                            <input type="text"  v-model="displace.houseName"  v-if="showInput('0')">
                            <span v-else class="pull-left">{{displace.houseName}}</span>
                        </td>
                        <td style="color:black;background-color:#F8F8F8;position: relative"><i class="biTian">*</i>楼号、单元</td>
                        <td class="td-value2">
                            <input type="text"  v-model="displace.buildingNumber" v-if="showInput('0')">
                            <span v-else class="pull-left">{{displace.buildingNumber}}</span>
                        </td>


                    </tr>

                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8">面积(平方米)</td>
                        <td style="position: relative" class="td-value2">
                            <input type="text"  v-model="displace.area" v-if="showInput('0')">
                            <span v-else class="pull-left">{{displace.area}}</span>
                            <!--<span class="yuan">平方米</span>-->
                        </td>
                        <td style="color:black;background-color:#F8F8F8;position: relative"><i class="biTian">*</i>房屋位置</td>
                        <td class="td-value2">
                            <input type="text"  v-model="displace.houseAddress" v-if="showInput('0')">
                            <span v-else class="pull-left">{{displace.houseAddress}}</span>
                        </td>
                    </tr>


                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8">产权年限</td>
                        <td class="td-value2">
                            <input type="text"  v-model="displace.housesProperty" v-if="showInput('0')">
                            <span v-else class="pull-left">{{displace.housesProperty}}</span>
                        </td>
                        <td style="color:black;background-color:#F8F8F8;position: relative"><i class="biTian">*</i>状态</td>
                        <td class="td-value2 moreList" data-table="t_dvc_displace" data-column="state" data-type='1'>
                           <select v-if="showInput('状态')" v-model="displace.state" style="color: #2a8cec !important;padding-left: 2px;">
                                <option v-for="option in stateList" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="pull-left">{{displace.state}}</span>
                        </td>
                    </tr>


                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8;"><i class="biTian">*</i>是否过户</td>
                        <td class="td-value2 moreList" data-table="t_dvc_displace" data-column="transfer" data-type='1'>
                            <select v-if="showInput('是否过户')" v-model="displace.transfer" style="color: #2a8cec !important;padding-left: 2px;">
                                <option v-for="option in transferList" v-bind:value="option.value">
                                    {{option.text}}
                                </option>
                            </select>
                            <span v-else class="pull-left">{{displace.transfer}}</span>
                        </td>
                        <td  style="color:black;background-color:#F8F8F8;">评估价格(元)</td>
                        <td style="position: relative" class="td-value2 moreList" data-table="t_dvc_displace" data-column="estimatePrice" data-type='1'>
                            <input type="text"
                                   @blur="strFormat($event.target,'displace.estimatePrice')"
                                   @focus="strFormatF($event.target,'displace.estimatePrice')"
                                   v-onedate="fmoney(displace.estimatePrice)" v-if="showInput('评估价格')">
                            <span v-else class="pull-left">{{fmoney(displace.estimatePrice)}}</span>
                            <!--<span class="yuan">  元</span>-->
                        </td>

                    </tr>


                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8 ;">置换价格(元)</td>
                        <td style="position: relative" class="td-value2 moreList" data-table="t_dvc_displace" data-column="replacementPrice" data-type='1'>
                            <input type="text" style="position: relative"
                                   @blur="strFormat($event.target,'displace.replacementPrice')"
                                   @focus="strFormatF($event.target,'displace.replacementPrice')"
                                   v-onedate="fmoney(displace.replacementPrice)" v-if="showInput('置换价格')">
                            <span v-else class="pull-left">{{fmoney(displace.replacementPrice)}}</span>
                            <!--<span class="yuan">  元</span>-->
                        </td>
                        <td style="color:black;background-color:#F8F8F8;">出售价格(元)</td>
                        <td style="position: relative" class="td-value2 moreList" data-table="t_dvc_displace" data-column="sellPrice" data-type='1'>
                            <input style="position: relative" type="text"
                                   @blur="strFormat($event.target,'displace.sellPrice')"
                                   @focus="strFormatF($event.target,'displace.sellPrice')"
                                   v-onedate="fmoney(displace.sellPrice)" v-if="showInput('出售价格')">
                            <span v-else class="pull-left">{{fmoney(displace.sellPrice)!=0?displace.sellPrice:"未出售"}}</span>
                            <!--<span class="yuan">  元</span>-->

                        </td>

                    </tr>
                    <tr class="td-row2 td-value" style="height:30px">
                        <td style="color:black;background-color:#F8F8F8">不动产权证/合同/协议</td>
                        <td class="td-row2 td-value1" colspan="2">
                            <div id="divUploadedFiles">
                                <div class="fj-tanzhongStyle "  v-for="(attach,i) in displace.attaches">
                                    <b :class="fjStyle(attach.name)"></b>
                                    <div class="name" v-if="attach.name" :title="attach.name" v-on:click="download(attach.url,attach.name)">{{attach.name}}</div>
                                    <div class="down"><a href="javascript:void(0)" class="nui-txt-link" v-on:click="download(attach.url,attach.name)">下载</a></div>
                                    <div class="del" v-if="pageType!='look'&&attach.name"><a href="javascript:void(0)" class="nui-txt-link" @click="deleteFile5(i)" >删除</a></div>
                                    <!--<div class="info">11.35K <span class="nui-txt-suc">上传完成</span></div>-->
                                </div>
                            </div>
                        </td>
                        <td >
                            <div v-if="showInput('合同')" id="divUpload" class="rightBorder fj fujian">
                                上传附件
                            </div>
                        </td>
                    </tr>
                    <tr class="td-row2 td-value" style="height:30px">
                        <td class="td-title" rowspan="2" style="line-height: 48px;">备注</td>
                        <td rowspan="2" colspan="3" class="td-value2 moreList " data-table="t_dvc_displace" data-column="remark" data-type='1'>
                            <textarea type="text"   v-model="displace.remark" v-if="showInput('备注')" style="box-shadow: inset 1px 1px 4px #333;
                              width: 100%;height: 100%; position: absolute;top: 0;left: 0;"></textarea>
                            <span v-else class="pull-left">{{displace.remark}}</span>
                        </td>
                    </tr>
                    <tr></tr>
                </table>

                <div style="padding: 10px 0;align-content:center;" align="center">
                    <input type="button"  class="btn oaBtn btn-sm" @click="save(displace.id,-1)" value="保存草稿">
                    <input type="button"  class="btn oaBtn btn-sm" @click="save(displace.id,1)" value="提交"
                           style="margin-left: 20px ;"  >
                </div>
            </div>
        </div>

    </div>

</section>

</body>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=0b5caf39"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=0c4d95a9"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
    $(function () {
        $("body").on("click", ".moreList", function (e) {
            var tableName = $(this).attr("data-table");
            var column = $(this).attr("data-column");
            var columnName = $(this).attr("data-columnName");
            var mainKey = $(this).attr("data-column");
            var mid = $(this).attr("data-mid");
            var type = $(this).attr("data-type");
            if ($(this).hasClass("jiaobiao3")) {
                $.dialog({
                    content:'url:/page/logs/logs.html?tableName=' + tableName + '&column=' + column+'&columnName=' + columnName + "&mainKey=" + mainKey + "&mid=" + mid + '&type='+type+'&id='+app.displace.id,
                    title: '修改日志',
                    width:600,
                    height:500,
                    max: false,
                    min: false,
                    lock: true
                });
            }
        });
        $("body").on("click", ".moreListData", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".moreListData").hide();
        });
    });
</script>
<script type="text/javascript">
    //var api = frameElement.api, W = api.opener;
    // 注册一个局自定义指令 `v-inputOnce`
    Vue.directive('onedate', {
        // 当被绑定的元素插入到 DOM 中时……
        update: function (el, binding) {
            // 聚焦元素
            if (app.pageType == 'edit'&&app.isAdd!='1') {
                if (el.value == "NaN.undefined" || el.value == "") {
                    el.value = binding.value
                }
            }
        },
        componentUpdated: function (el, binding) {
            // 聚焦元素


        }
    });
    var app = new Vue({
        el: '#app',
        data: {
            openType: $.wyui.page.urlParams.openType ? $.wyui.page.urlParams.openType : 'top',
            isAdd:$.wyui.page.urlParams.isAdd,
            pageType:$.wyui.page.urlParams.pageType,
            userId:getCurrentUser().id,
            companyList:[],
            regions:[],//区域
            bigRegionManager:[],//大区经理
            regionManager:[],//区域经理
            replacementTypeList: [
                {text: '', value: ''},
                {text: '住宅', value: '住宅'},
                {text: '门面', value: '门面'},
                {text: '别墅', value: '别墅'},
                {text: '安置房', value: '安置房'}
            ],
            transferList: [
                {text: '', value: ''},
                {text: '已更名-未过户', value: '已更名-未过户'},
                {text: '已过户', value: '已过户'},
                {text: '未更名', value: '未更名'}
            ],
            stateList: [
                {text: '', value: ''},
                {text: '未售', value: '未售'},
                {text: '已售', value: '已售'}
            ],
            displace:{
                whetherToClose:1,
                existFlag:1,
                    id:$.wyui.page.urlParams.id,
                    fkCompanyId:'',
                    companyName:'',
                    houseName:'',
                    houseAddress:'',
                    state:'',
                    buildingNumber:'',
                    createUserId:getCurrentUser().id,
                    createUserName:getCurrentUser().name,
                    auditFlag:-1,
                    auditId: '',
                    area:'',
                    remark:'',
                    housesProperty:'',
                    replacementPrice:'',
                    replacementsName:'',
                    estimatePrice:'',
                    regionId:'',
                    regionName:'',
                    regionManagerId:'',
                    regionManagerName:'',
                    bigregionManagerId:'',
                    bigregionManagerName:'',
                    sellPrice:'',
                    transfer:'',
                    kilometers:'',
                    storeAddress:'',
                    type:'3',
                    delFlag:'0',
                    replacementType:'',
                    attaches:[],
                },
            editAble:true,

        },
        methods: {
            showToday:function (updateTime) {
                var dateTime = new Date().Format("yyyy-MM-dd");
                if(dateTime==updateTime){
                    return true;
                }else{
                    return false;
                }
            },
            fjStyle:function(fjName){
                if(fjName){
                    var type=fjName.substring(fjName.lastIndexOf('.') + 1);
                    return 'img fj-'+type
                }
                return 'img'
            },
            showInput: function (type) {
                var pageType = $.wyui.page.urlParams.pageType;
                //草稿、驳回状态可重新编辑
                var auditFlag = $.wyui.page.urlParams.auditFlag
                var that=this;
                if (auditFlag == "-1" || (auditFlag == "2")) {
                    that.isAdd=1;
                }
                if(pageType=='add'){
                    return true;
                }
            },
            convertAuditFlagToName: function (auditFlag) {
                //auditFlag:-1,0,1,2,3,4,5,6
                switch (auditFlag) {
                    case -1:
                        return "未提交";
                        break;
                    case 0:
                        return "审核中";
                        break;
                    case 1:
                        return "通过";
                        break;
                    case 2:
                        return "驳回";
                        break;
                    default :
                        break;
                }
            },
            save:function (id,auditFlag) {
                var that=this;
                that.displace.regionName = $("#testRe option:selected").text();
                that.displace.regionManagerName=$("#testReg option:selected").text();
                that.displace.bigregionManagerName = $("#testBig option:selected").text();
                that.displace.companyName=$("#company option:selected").text();
                that.displace.auditFlag=auditFlag;
                that.displace.createUserId=getCurrentUser().id;
                that.displace.createUserName=getCurrentUser().name;

                if(!that.displace.companyName){
                    alert("请输入归属公司")
                    return;
                }
                if(!that.displace.houseName){
                    alert("请输入房屋名称")
                    return;
                }
                if(!that.displace.houseAddress){
                    alert("请输入房屋位置")
                    return;
                }
                if(!that.displace.buildingNumber){
                    alert("请输入楼号单元")
                    return;
                }
                if(!that.displace.replacementType){
                    alert("请输入房屋类型")
                    return;
                }
                if(!that.displace.state){
                    alert("请输入状态")
                    return;
                }
                if(!that.displace.transfer){
                    alert("请输入是否过户")
                    return;
                }
                if(that.editAble==false){
                    return;
                }
                that.editAble = false;
                if (!that.displace.sellPrice){
                    that.displace.sellPrice=0.00
                }
                if (!that.displace.estimatePrice){
                    that.displace.estimatePrice=0.00
                }
                if (!that.displace.replacementPrice){
                    that.displace.replacementPrice=0.00
                }
                that.displace.updateUserId=getCurrentUser().id;
                that.displace.updateUserName=getCurrentUser().name;
                $.wyui.postMethod('/deviceDisplace/saveNew.json',trimRN(that.displace),function (r) {
                    var records=r.records;
                    if (r.records == "保存成功") {
                        var title;
                        if(auditFlag=='1'){
                            title='添加成功';
                        }else{
                            title='保存草稿成功'
                        }
                        top.$.alert({
                            title: title,
                            content: '',
                            icon: '1', //1成功 2失败 3提示 不穿代表无图标
                            height: 180,
                            width: 300,

                            blankclose: true,//点击空白是否可关闭
                            cancel: "确定",
                            cancelCallback:function(em, opts){
                                em.remove()
                                opts.close && opts.close()
                                var pageId = top.getActivePageId();
                                var $iframe = top.findIframeByName("库存管理");
                                $iframe[0].contentWindow.$("#iframeBox")[0].contentWindow.app.sel();
                                top.closeTabByPageId(pageId);
                            }
                        })
                        return false;
                    } else if (r.records == "序列号已存在") {
                        alert("序列号已存在");
                        return false;
                    }
                })


            },

            getBran: function () {
                var that = this;
               $.wyui.postMethod('/deviceDisplace/findRegionByCompanyId.json', {companyId: that.displace.fkCompanyId }, function (r) {
                    that.regions = r.regions;
                })

            },

            getBigRegionManager:function () {
                var that = this;
                $.wyui.postMethod('/deviceDisplace/findBigRegionManagerByRegionId.json', {regionId:that.displace.regionId}, function (r) {
                    that.bigRegionManager = r.regions;
                })
            },
            getRegionManager:function () {
                var that = this;
                $.wyui.postMethod('/deviceDisplace/findRegionManagerByBigRegionManagerId.json', {bigRegionId: that.displace.regionId}, function (r) {
                    that.regionManager = r.regions;
                })
            },
            strFormat: function (target, data) {
                //此结果为了展示数据
                var value = (target.value).trim();
                value = value.replace(/[^\d{1,}\.\d{1,}|\d{1,}]/g, '');
                if (!value) {
                    value = 0
                }
                ;
                //此结果为data存入数据
                var dataList = data.split('.');

                if (dataList.length > 0) {
                    if (dataList.length == 1) {
                        this[dataList[0]] = value;
                    }
                    if (dataList.length == 2) {
                        this[dataList[0]][dataList[1]] = value;
                    }
                    if (dataList.length == 3) {
                        this[dataList[0]][dataList[1]][dataList[2]] = value;
                    }
                    if (dataList.length == 4) {
                        this[dataList[0]][dataList[1]][dataList[2]][dataList[3]] = value;
                    }
                    if (dataList.length == 5) {
                        this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]] = value;
                    }
                }
                target.value = this.fmoney(value);
            },
            strFormatF: function (target, data) {
                var value = '';
                var dataList = data.split('.');

                if (dataList.length > 0) {
                    if (dataList.length == 1) {
                        value = this[dataList[0]]
                    }
                    if (dataList.length == 2) {
                        value = this[dataList[0]][dataList[1]]
                    }
                    if (dataList.length == 3) {
                        value = this[dataList[0]][dataList[1]][dataList[2]]
                    }
                    if (dataList.length == 4) {
                        value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]]
                    }
                    if (dataList.length == 5) {
                        value = this[dataList[0]][dataList[1]][dataList[2]][dataList[3]][dataList[4]]
                    }
                }
                if (!value || value == '0.00') {
                    console.log('获取焦点', value)
                    value = '';
                }
                target.value = value;
            },
            deleteFile5: function (i) {
                if (window.confirm("确定要删除该附件吗?")) {
                    this.displace.attaches.splice(i, 1);
                }
            },
            download: function (attachId, fileName) {
                downloadFile(attachId,fileName)
                return false;
            },
            close:function () {
                api.close();
            },
            fmoney: function (s, n) {
                n = n > 0 && n <= 20 ? n : 2;
                s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";
                var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1],
                    t = "";
                for (i = 0; i < l.length; i++) {
                    t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
                }
                return t.split("").reverse().join("") + "." + r;
            },
            showDatePicker: function (e, index) {
                var that = this;
                console.log(index)
                WdatePicker({
                    onpicked: function (dp) {
                        that.customer.years = dp.cal.getNewDateStr();
                        return true;
                    }
                });
                $(e.target).blur();
            },
            //获取日志
            getMoreHistory:function () {
                var that=this;
                $(".moreList").each(function() {
                    console.log($(this));
                    var demo = $(this);
                    var tableName = $(this).attr("data-table");
                    var type = $(this).attr("data-type");
                    if(type=='1'){
                        var columnName = $(this).attr("data-column");
                        $.wyui.postMethod("/logs/getColumnLogsNum.json", {
                            "tableName":tableName,
                            "columnName":columnName,
                            "updateId":that.displace.id
                        }, function (data) {
                            console.log(data)
                            if (data.result) {
                                var p = new Array();
                                p.push("<i></i>");
                                demo.addClass("jiaobiao3");
                                if(that.showToday(data.updateTime)){
                                    demo.children("span").css("color","#ff0000");
                                }
                                demo.append(p.join(""))
                            }
                        })
                    }
                    else if(type=="2"){
                        var columnName = $(this).attr("data-columnName");
                        var mainKey = $(this).attr("data-column");
                        var mid = $(this).attr("data-mid");
                        $.wyui.postMethod("/logs/getTableLogsNum.json", {
                            "tableName":tableName,
                            "columnName":columnName,
                            "mainKey":mainKey,
                            "id":mid
                        }, function (data) {
                            console.log(data)
                            if (data.result) {
                                var p = new Array();
                                p.push("<i></i>");
                                demo.addClass("jiaobiao3");
                                if(that.showToday(data.updateTime)){
                                    demo.children("span").css("color","#ff0000");
                                }
                                demo.append(p.join(""))
                            }
                        })
                    }
                })
            },
        },
        mounted: function () {
            var that = this;
            this.uploader = WebUploader.create({
                // 选完文件后，是否自动上传。
                auto: true,
                // swf文件路径
                swf: "/statics/plugin/webuploader-0.1.5/Uploader.swf",
                // 文件接收服务端。
                server: server.fjIp + "/attach/uploadFile.json",
                // 选择文件的按钮。可选。
                // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                pick: '#divUpload',
                duplicate: true
            });
            this.uploader.on("uploadStart", function () {
                $("#progress").show();
            });
            this.uploader.on("uploadComplete", function () {
                $("#progress").hide();
            });
            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
            this.uploader.on('uploadSuccess', function (file, response) {
                if (response._raw == "文件上传出错！") {
                    alert("文件上传出错！");
                } else {
                    that.displace.attaches.push({
                        id: response.id,
                        name: response.name,
                        url: response.url
                    });
                }
            });
            // 文件上传失败，显示上传出错。
            this.uploader.on('uploadError', function (file) {
                alert("上传失败！");
            });
            if ($.wyui.page.urlParams.pageType!='look'){
                $.wyui.postMethod('/company/getCompanyListByUserId.json', {userId:getCurrentUser().id}, function (r) {
                    that.companyList = r;
               })
            }
            if ($.wyui.page.urlParams.isAdd==0){
                $.wyui.postMethod('/deviceDisplace/getDisplaceById.json', {id: $.wyui.page.urlParams.id}, function (r) {
                    that.displace = r.displace

                /*查询区域*/
                $.wyui.postMethod('/deviceDisplace/findRegionByCompanyId.json', {companyId:r.displace.fkCompanyId}, function (r) {
                    that.regions = r.regions;
                })
                /*查询大区经理*/
                $.wyui.postMethod('/deviceDisplace/findBigRegionManagerByRegionId.json', {regionId:r.displace.regionId}, function (r) {
                    that.bigRegionManager = r.regions;
                })
                    /*查询区域经理*/
                    $.wyui.postMethod('/deviceDisplace/findRegionManagerByBigRegionManagerId.json', {bigRegionId: r.displace.regionId}, function (r) {
                        that.regionManager = r.regions;
                    })
                });
                if($.wyui.page.urlParams.pageType=='look'){
                    that.getMoreHistory();
                }
            }

        }

    })
</script>
<script>
    $("#regionManager").autoComplete({
        url: server.ip + urlConfig.contract.getRegionManagerByUserId,
        render: function (users, panel) {
            for (var i = 0; i < users.length; i++) {
                $("<li></li>").data("autoComplete",
                    users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                    "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                    .appendTo(panel);
            }
        },
        selected: function (user) {
            app.displace.regionManager = user.name;
            return false;
        },
        extraParams: {createUserId: getCurrentUser().id},
        height: 210,
        width: 320
    });
    $("  #bigRegionManager").autoComplete({
        url: server.ip + urlConfig.contract.getRegionManagerByUserId,
        render: function (users, panel) {
            for (var i = 0; i < users.length; i++) {
                $("<li></li>").data("autoComplete",
                    users[i]).html("<a>" + users[i].name + "&nbsp;&nbsp;&nbsp;" +
                    "(" + "&nbsp;" + users[i].companyName + "-" + users[i].departName + "-" + users[i].roleName + "&nbsp;" + ") " + "</a>")
                    .appendTo(panel);
            }
        },
        selected: function (user) {
            app.displace.bigregionManager = user.name;
            return false;
        },
        extraParams: {createUserId: getCurrentUser().id},
        height: 210,
        width: 320
    });
</script>
</html>